
#include <stdio.h>
#include "STLOG.h"
#include "STL_RtspEnableTest.h"
#include <unistd.h>
#include <memory>

using namespace STL;

int main(int argc, char *argv[])
{
    // STL_RtspEnableTest::getInstance();
    STL_RtspEnableTest::getInstance()->setResultCallback([](std::string rtspUrl, STL_RtspEnableTest::TestStatus status, std::string sdp) {
        switch (status)
        {
        case STL_RtspEnableTest::TestStatus::TestStatus_InitError:
            stlog_info("ResultCallback[Init Error] rtspUrl:%s\n", rtspUrl.c_str());
            break;
        case STL_RtspEnableTest::TestStatus::TestStatus_ConnectError:
            stlog_info("ResultCallback[Connect Error] rtspUrl:%s\n", rtspUrl.c_str());
            break;
        case STL_RtspEnableTest::TestStatus::TestStatus_TestError:
            stlog_info("ResultCallback[Test Error] rtspUrl:%s\n", rtspUrl.c_str());
            break;
        case STL_RtspEnableTest::TestStatus::TestStatus_AuthorzationError:
            stlog_info("ResultCallback[Authorzation Error] rtspUrl:%s\n", rtspUrl.c_str());
            break;
        case STL_RtspEnableTest::TestStatus::TestStatus_Successed:
            stlog_info("ResultCallback[Successed] rtspUrl:%s\n", rtspUrl.c_str());
            stlog_info("sdp:%s\n", sdp.c_str());
            break;
        default:
            stlog_info("ResultCallback[status:%d] rtspUrl:%s\n", status, rtspUrl.c_str());
            break;
        };
        stlog_info("---------------------------------------------------------------------------------\n");
    });

    STL_RtspEnableTest::getInstance()->addTestRtspUrl("rtsp://admin:julong123@192.168.1.103:554/cam/realmonitor?channel=1&subtype=0&unicast=true&proto=Onvif");
    STL_RtspEnableTest::getInstance()->addTestRtspUrl("rtsp://admin:julong123@192.168.1.80:554/cam/realmonitor?channel=3&subtype=0&unicast=true&proto=Onvif");
    STL_RtspEnableTest::getInstance()->addTestRtspUrl("rtsp://admin:julong123@192.168.1.81:554/cam/realmonitor?channel=3&subtype=0&unicast=true&proto=Onvif");
    STL_RtspEnableTest::getInstance()->addTestRtspUrl("rtsp://admin:admin@192.168.1.81:554/cam/realmonitor?channel=3&subtype=0&unicast=true&proto=Onvif");
    STL_RtspEnableTest::getInstance()->addTestRtspUrl("rtsp://admin:julong123@192.168.1.82:554/cam/realmonitor?channel=3&subtype=0&unicast=true&proto=Onvif");
    stlog_debug("Hello World!\n");
    int time = 0;
    while (1)
    {
        stlog_debug("%d...\n", time++);
        sleep(1);
    }

    return 0;
}
